package com.starlink.model.util;

import com.starlink.model.dtomapper.FreeDeliveryTermsDtoMapper;
import com.starlink.model.domain.FreeDeliveryTermsDO;
import com.starlink.model.vo.FreeDeliveryTermsVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhanghong
 */
public class FreeDeliveryTermsConvert {

    public static List<FreeDeliveryTermsVO> buildFreeDeliveryTermsVoList(List<FreeDeliveryTermsDO> freeDeliveryTermsDOList) {
        if (CollectionUtils.isEmpty(freeDeliveryTermsDOList)) {
            return Lists.newArrayList();
        }
        List<FreeDeliveryTermsVO> freeDeliveryTermsVOList = new ArrayList<>();
        for (FreeDeliveryTermsDO freeDeliveryTermsDO : freeDeliveryTermsDOList) {
            freeDeliveryTermsVOList.add(FreeDeliveryTermsDtoMapper.INSTANCE.do2VO(freeDeliveryTermsDO));
        }

        return freeDeliveryTermsVOList;
    }
}
